<template>
  <div>
    <el-form ref="GoodsOeders" label-width="120px">
      <el-form-item label="商品名">
        <el-input v-model="GoodsOeders.goodsName"></el-input>
      </el-form-item>
      <el-form-item label="商品数量">
        <el-input v-model="Goods.goodsOrderNumber"></el-input>
      </el-form-item>
      <el-form-item label="收货地址">
        <el-input v-model="Goods.goodsOrderAddress"></el-input>
      </el-form-item>
      <el-form-item label="手机号码">
        <el-input v-model="Goods.goodsOrderTel"></el-input>
      </el-form-item>
      <el-form-item label="姓名">
        <el-input v-model="Goods.goodsOrderReceiver"></el-input>
      </el-form-item>
      <el-form-item label="状态">
        <el-input v-model="Goods.goodsOrderState"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">确定</el-button>
        <el-button>取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>

import {updateGoodsOrder} from "@/services/GoodsOrderService.js"

export default {
    data() {
    return {
      GoodsOeders:{
        goodsName:'',
        goodsOrderId:'',
        goodsOrderReceiver:'',
        goodsOrderTel:'',
        goodsOrderAddress:'',
        goodsOrderState:'',
        goodsOrderDate:'',
        goodsOrderPrice:'',
        goodsOrderNumber:''
      }
    };
  },
  methods: {
    async onSubmit() {
      var resp = await updateGoods(this.Goods, this.$route.params.goodsId);
      if (resp == true) {
        console.log("修改成功");
        this.$router.push({ name: "Goods" });
      } else {
        console.log("修改失败");
      }
    },
  },
  async created() {
    console.log("---------");
    console.log(this.$route.params.goodsId);
    var resp1 = await selectById(this.$route.params.goodsId);
    this.Goods = resp1;
    console.log(this.Goods);
  },
};
</script>

<style>
</style>